package pl.edu.mimuw.irs.rcp.controller.editor.workflow.command;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.commands.Command;

import pl.edu.mimuw.irs.core.model.design.net.IRSNode;
import pl.edu.mimuw.irs.core.util.Position;

/**
 * @author Jakub Rauch
 * Created on: 2009-05-18
 */
public class IRSNodeMoveCommand extends Command {

	// *** Attributes

	private IRSNode irsNode;
	private Rectangle oldBounds;
	private Rectangle newBounds;
	
	// *** Methods

	public IRSNodeMoveCommand(IRSNode irsNode, Rectangle oldBounds, Rectangle newBounds) {
		super();
		this.irsNode = irsNode;
		this.oldBounds = oldBounds;
		this.newBounds = newBounds;
	}

	public void execute() {
		irsNode.setCustomPosition(new Position(newBounds.x, newBounds.y));
		//nodePart.moveTo(newBounds);
	}

	public void undo() {
		irsNode.setCustomPosition(new Position(oldBounds.x, oldBounds.y));
	}

}
